home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBGRX100.ARJ / BITBLT.C < prev    next >
Text File  |  1992-04-10  |  2KB  |  60 lines

  1. /** 
  2.  ** BITBLT.C 
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24. #include "grx.h"
  25. #include "libgrx.h"
  26. #include "clipping.h"
  27.  
  28. void GrBitBlt(GrContext *dst,int x,int y,
  29.           GrContext *src,int x1,int y1,int x2,int y2,int oper)
  30. {
  31.     int oldx,oldy;
  32.     int msflag = FALSE;
  33.  
  34.     if(dst == NULL) dst = CURC;
  35.     if(src == NULL) src = CURC;
  36.     SORT2(x1,x2);
  37.     SORT2(y1,y2);
  38.     oldx = x1;
  39.     oldy = y1;
  40.     CLIPBOXTOCONTEXT(src,x1,y1,x2,y2);
  41.     x += (x1 - oldx);
  42.     y += (y1 - oldy);
  43.     x2 += ((oldx = x) - x1);
  44.     y2 += ((oldy = y) - y1);
  45.     CLIPBOX(dst,x,y,x2,y2);
  46.     x1 += (x - oldx);
  47.     y1 += (y - oldy);
  48.     if(_GrMouseDrawn) msflag =
  49.         (*_GrMouseBlock)(src,x1,y1,(x1 + x2 - x),(y1 + y2 - y)) |
  50.         (*_GrMouseBlock)(dst,x,y,x2,y2);
  51.     _GrPixCopy(dst,PIX_ADDR(dst,x,y),
  52.         src,PIX_ADDR(src,x1,y1),
  53.         (x2 - x + 1),
  54.         (y2 - y + 1),
  55.         oper
  56.     );
  57.     if(msflag) (*_GrMouseUnBlock)();
  58. }
  59.  
  60.